<?php
/**
 * 客户操作日志模型
 */

namespace app\model\customer;

use think\Model;
use app\model\admin\User; // 引入User模型

class CustomerLog extends Model
{
    // 设置表名
    protected $name = 'customer_log';
    
    // 设置主键
    protected $pk = 'id';
    
    // 时间字段
    protected $createTime = 'create_time';
    protected $updateTime = false;
    
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y-m-d H:i:s';
    
    /**
     * 关联用户模型
     */
    public function admin()
    {
        return $this->belongsTo(User::class, 'admin_id')->bind([
            'username' => 'username',
            'nickname' => 'nickname'
        ]);
    }
}